package net.zisen.cloud.wallet.client;

import net.zisen.cloud.base.msg.ResultMsg;
import net.zisen.cloud.wallet.fallback.WalletClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * @author tim/278002989@qq.com
 * @Classname WalletClient
 * @Description TODO
 * @Date 2019-05-17 18:20
 */
@FeignClient(value = "PING-WALLET-PROVIDER", fallbackFactory = WalletClientFallback.class)
public interface WalletClient {

    /**
     * 扣除钱包金额
     *
     * @param uid
     * @param amount
     * @param num
     * @param description
     * @return
     */
    @RequestMapping(value = "wallet/deduct", method = RequestMethod.GET)
    ResultMsg deduct(@RequestParam Long uid, @RequestParam BigDecimal amount, @RequestParam String num, @RequestParam String description);


    /**
     * 查询钱包余额
     *
     * @param uid
     * @return
     */
    @RequestMapping(value = "wallet/balance", method = RequestMethod.GET)
    ResultMsg<BigDecimal> checkWalletBalance(@RequestParam Long uid);
}
